package demo.controller;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import demo.interceptor.ClassInterceptor;
import demo.interceptor.MethodInterceptor;
import demo.service.DemoService;
import demo.service.InjectDemoService;

/**
 * Created by ldt on 2017/5/23.
 */
@Before(ClassInterceptor.class)
public class HelloController extends Controller {
    @Before(MethodInterceptor.class)
    public void index(){
        System.out.println(getPara());
        InjectDemoService injectDemoService = enhance(InjectDemoService.class,ClassInterceptor.class);
        injectDemoService.inject(3,4);
        renderText("Hello JFinal World!");
    }
//    @Clear(ClassInterceptor.class)
    public void sayGoodBye(){
        DemoService demoService = enhance(DemoService.class);
        demoService.change(3,5);
        System.out.println("say GoodBye");
    }
}
